//
//  CYCardListNoneCell.m
//  cyjf
//
//  Created by tauCross on 2017/5/17.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYCardListNoneCell.h"



@interface CYCardListNoneCell ()

@property(nonatomic, strong)UIImageView *noneImageView;
@property(nonatomic, strong)UILabel *noneLabel;

@end


@implementation CYCardListNoneCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        self.backgroundColor = [UIColor clearColor];
        self.contentView.backgroundColor = [UIColor clearColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.noneImageView = [[UIImageView alloc] initWithImage:CYImage(@"card_list_none")];
        [self.contentView addSubview:self.noneImageView];
        
        self.noneLabel = [[UILabel alloc] init];
        self.noneLabel.textColor = HEXCOLOR(@"999999");
        self.noneLabel.font = [UIFont systemFontOfSize:16];
        self.noneLabel.text = @"您还没有添加银行卡";
        [self.noneLabel sizeToFit];
        [self.contentView addSubview:self.noneLabel];
    }
    return self;
}

+ (CGFloat)heightForObject:(id)object atIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView
{
    return 178;
}

- (BOOL)shouldUpdateCellWithObject:(id)object
{
    [self setNeedsLayout];
    return YES;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.noneImageView.centerX = self.contentView.width / 2;
    self.noneImageView.bottom = self.contentView.height - 42;
    
    self.noneLabel.centerX = self.noneImageView.centerX;
    self.noneLabel.centerY = self.contentView.height - 21;
}

@end
